package com.study.happystudy.po;

import com.study.happystudy.mapper.UserMapper;
import com.study.happystudy.tool.ColorChange;
import jakarta.annotation.Resource;
import lombok.Data;

import java.awt.*;

@Data
public class Course {
    private String teacherAvatar;// 老师头像
    private int courseId;// 主键
    private int userId;// 老师id
    private String tyep;// 课程类型
    private String courseName;// 课程名称
    private String courseDescription;// 课程简介
    private String startTime;// 开课时间
    private String endTime;// 结课时间
    private String duration;// 课时
    private int grade;// 年级
    private int subjectId;// 科目id
    private String classTime;// 上课时间
    private String imgUrl;// 课程图片
    private String startClass;// 开课时间
    private String endClass;// 下课时间

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public void setCourseId(int courseId) {
        this.courseId = courseId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public void setCourseDescription(String courseDescription) {
        this.courseDescription = courseDescription;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    public void setSubjectId(int subjectId) {
        this.subjectId = subjectId;
    }

    public void setClassTime(String classTime) {
        this.classTime = classTime;
        if (classTime.contains("已结课")) {
            return;
        }
        try {
            ColorChange.Blue(classTime + "\n");
            String[] ss = classTime.split(",");
            String[] cl = ss[1].split("-");
            startClass = cl[0];
            endClass = cl[1];
        }catch (Exception e){
            ColorChange.Red(classTime + "\n");
        }
    }

}
